package com.zhiliao.chain.demo3;

/**
 * @author zouxf
 * @date 2023/8/29 9:04
 * @description
 */
public class ChannelContextHandler {

    private ChannelContextHandler next;
    private AbstractHandler handler;

    public ChannelContextHandler(AbstractHandler handler) {
        this.handler = handler;
    }

    public void executeNext(Object arg0){
        if (null == next) {
            System.out.println("到达终点·");
            return;
        }
        this.next.doHandler(arg0);
    }

    public void doHandler(Object arg0) {
        this.handler.doHandler(this, arg0);
    }

    public ChannelContextHandler getNext() {
        return next;
    }

    public void setNext(ChannelContextHandler next) {
        this.next = next;
    }
}
